package com.youku.ast;

import com.youku.compiler.Token;

public class BlockWithConditionAst extends Ast {

	public BlockWithConditionAst(Token token, Ast condition, Ast block) {
		super(token, condition, block);
	}

	public Ast condition() {
		return getChild(0);
	}

	public Ast block() {
		return getChild(1);
	}

	@Override
	public String toString() {
		if (condition() == null) {
			return block().toString();
		} else {
			return "(" + condition() + ")" + block();
		}

	}

}
